[#import "/framework/JGP.htm"  as JGP]
<!--
项目   jgp-cloud-parent
作者   LOUFEI [Gavin]
时间   2018/12/23
-->
[@JGP.head "Title"/]
[@JGP.body]
    <jgp-div _row="['40','*']" _runit="px">
        <div slot="1-1">
            <jgp-btn _form="itemForm" _fn="saveCallback">保存</jgp-btn>
        </div>
        <jgp-form slot="2-1" _id="itemForm"
                  _action="/workflow/editorApiController/saveCategory">
            <jgp-text _name="label" _label="类型名" _col="12" _required="true"></jgp-text>
            <jgp-text _name="value" _label="类型标识" _col="12" _onchange="upperCase"></jgp-text>
        </jgp-form>
    </jgp-div>
[/@JGP.body]

[@JGP.foot]
    <script>
        var categoryId = '${categoryId!''}';

        JGP.$onload(function(){
            if(categoryId){
                JGP.$post('/workflow/editorApiController/queryCategoryById',{categoryId:categoryId},function(result){
                    var fdata = result.data.fdata;
                    JGP.form('itemForm').setFdata(fdata);
                })
            }

        });

        function upperCase(result) {
            if (result.back)
                JGP.form('itemForm').field('value', result.back.toUpperCase())
        }
        
        function saveCallback(result) {
            if(result.back.flag){
                JGP.$close(true);
            }
        }
    </script>
[/@JGP.foot]